import http from '@/utils/request.js';

// 获取困人任务详情
export const getRescue = (id) => {
	// return http.get('/repair/maintain/predicament/detail/detail?planId=' + id,{});
	return http.request({
		url: '/repair/maintain/predicament/detail/detail?planId=' + id,
		method: 'get',
		data: {},
	});
};

// 修改困人任务信息
export const setRescue = (data) => {
	// return http.post('/repair/maintain/plan/content/update', data, 1);
	return http.request({
		url: '/repair/maintain/plan/content/update',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 创建救援工单
export const createRescue = (data) => { 
	return http.request({
		url: '/repair/maintain/malfunction/rescue/add/work',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 修改困人详情信息
export const updataRescue = (data) => {
	// return http.post('/repair/maintain/predicament/detail/update', data, 1);
	return http.request({
		url: '/repair/maintain/predicament/detail/update',
		method: 'post',
		data,
		textJson: 1,
	});
};

// 创建救援工单-电梯列表选择
export const getRescueElevatorList = (data) => {
	return http.request({
		url: '/repair/building/rescueElevatorList',
		method: 'get',
		data
	});
};

// 查询某电梯救援中的工单
export const getRescueHis = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/rescue/detail/list',
		method: 'get',
		data
	});
};

// 查看调度人员列表 - 附近人员
export const getRescueUsers1 = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/map/rescue/building/recently/user',
		method: 'get',
		data
	});
};

// 查看调度人员列表 - 附近保养人员
export const getRescueUsers2 = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/map/rescue/building/recently/maintain/user',
		method: 'get',
		data
	});
};

// 查看调度人员列表 - 附近居住人员
export const getRescueUsers3 = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/map/rescue/building/recently/building/user',
		method: 'get',
		data
	});
};

// 指派人员
export const setRescueMember = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/planAddUser',
		method: 'post',
		data,
		textJson: 1
	});
};

// 救援管理列表
export const getRescues = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/dispatcher/page',
		method: 'get',
		data
	});
};

// 救援管理列表-顶部统计
export const getRescueStatistics = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/dispatcher/statistics',
		method: 'get',
		data
	});
};

// 报警列表-顶部统计
export const getNoticeStatistics = (data) => {
	return http.request({
		url: '/repair/rescue/notice/title/statistics',
		method: 'get',
		data
	});
};
// 报警列表-分页
export const getNoticeList = (data) => {
	return http.request({
		url: '/repair/rescue/notice/search/list',
		method: 'post',
		data,
		textJson: 1
	});
};

// 报警详情
export const getNoticeDetail = (data) => {
	return http.request({
		url: '/repair/rescue/notice/detail/by/id',
		method: 'get',
		data
	});
};

// 提交报警结果
export const confirmNoticeResult = (data) => {
	return http.request({
		url: '/repair/rescue/notice/confirm',
		method: 'post',
		data,
		textJson: 1
	});
};

// 撤销救援
export const resuceCancel = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/resuceCancel',
		method: 'get',
		data, 
	});
};

// 催办
export const resuceReminder = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/reminder',
		method: 'get',
		data, 
	});
};